﻿@model ETA.Entity.RegistrationMainForm

@{
    ViewBag.Title = "填写《赴日技能实习生登记表》";
    var basicInfo = Model.RegistrationBasicInfos.FirstOrDefault();
    var registrationEducations = Model.RegistrationEducations;
    var registrationJobs = Model.RegistrationJobs;
    var registrationFamilays = Model.RegistrationFamilays;
    var workTypeList = ViewBag.WorkTypeList as IEnumerable<ETA.Dtos.WorkTypeDto>;
    var selectedWorkTypeList = new List<string>();
    if (basicInfo != null && basicInfo.NewJobsList.Any())
    {
        selectedWorkTypeList = basicInfo.NewJobsList;//期望工种
    }
    var selectedWorkTypeStr = string.Empty;
}
<h3><strong>填写《赴日技能实习生登记表》</strong></h3>
<div class="container">
    <div class="mainTableform">

        <div class="pProjectSelected">
            <label for="textProjectSelected" id="lableForProjectSelected">赴日实习项目：</label>
            <input type="text" placeholder="选择实习项目" id="textProjectSelected" />
            <div id="divProject">
                <div class="poptitle">
                    <a onclick="" href="#" class="closeButton"></a>
                </div>
                <div>
                    <table style="width: 100%">
                        <tbody>
                            @foreach (var w in workTypeList)
                            { 
                                <tr class="popTr">
                                    <td>
                                        @if (selectedWorkTypeList.Any(s => s == w.WorkTypeId))
                                        {
                                            var index = w.WorkTypeName.IndexOf('（');
                                            if (index > 0)
                                            {
                                                selectedWorkTypeStr += w.WorkTypeName.Substring(0, w.WorkTypeName.IndexOf('（')) + ",";
                                            }
                                            else
                                            {
                                                selectedWorkTypeStr += w.WorkTypeName + ",";
                                            }
                                            <input  checked="checked" type="checkbox" value="@w.WorkTypeId" class="chkWorkType"/>
                                        }
                                        else
                                        {
                                            <input  type="checkbox" value="@w.WorkTypeId" class="chkWorkType"/>
                                        }
                                        <span class="spanProjectName">@w.WorkTypeName</span>
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                    @if (!string.IsNullOrEmpty(selectedWorkTypeStr))
                    {
                        selectedWorkTypeStr = selectedWorkTypeStr.Substring(0, selectedWorkTypeStr.Length - 1);
                    }
                    <input type="hidden" id="hiddenSelectedProject" value="@selectedWorkTypeStr"/>
                </div>
                <div class="popFooter">
                    <button type="button" class="btn btn-primary btn-lg" id="btnSaveProject">保存</button>
                </div>
            </div>
        </div>
        <p class="pItem">
            基本信息
            <button type="button" class="btn  btn-link btn-xs pull-right" id="btnEditBasicInfo"><span class="glyphicon glyphicon glyphicon-pencil"></span>&nbsp;编辑</button>
        </p>
        @using (Html.BeginForm("FillRegistrationForm", "Trainee", FormMethod.Post, new { name = "basicInfoForm", id = "basicInfoForm" }))
        {
            @Html.HiddenFor(m => m.RegistrationBasicInfos.FirstOrDefault().RegistrationBasicInfoId)
            @Html.HiddenFor(m => m.RegistrationBasicInfos.FirstOrDefault().RegistrationMainFormId)

            <table class="auto-style1" id="tableBasic">
                <tr>
                    <td class="auto-style13 col_name" rowspan="2">姓名</td>
                    <td class="auto-style17 col_name">拼音</td>
                    <td class="auto-style16">@Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().NamePinyin, new { @class = "longTxt" })</td>
                    <td class="auto-style15 col_name">出生年月</td>
                    <td class="auto-style14">@Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Birthday, new { @class = "longTxt date_txt input_font" })</td>
                    <td class="auto-style8 col_name">年龄</td>
                    <td class="auto-style9">@Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Age, new { @class = "longTxt" })</td>
                    <td rowspan="7" style="vertical-align: bottom">
                        <div>
                            <img id="divPicContent" src="" style="height: 166px; width: 144px" />
                            <input  name="ImageId" id="ImageId" type="hidden" value="@Model.RegistrationBasicInfos.FirstOrDefault().ImageId"/>
                            <div class="divResumeImageBtn" id="divResumeImageBtn"></div>
                            <div id="some_file_queue"></div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="auto-style17 col_name">汉字</td>
                    <td class="auto-style16">@Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Name, new { @class = "longTxt" })</td>
                    <td class="auto-style15 col_name">婚姻状况</td>
                    <td class="auto-style14" id="tdIsMarried">未婚 @Html.RadioButtonFor(m => m.RegistrationBasicInfos.FirstOrDefault().IsMarried, false, new { name = "IsMarried" })
                        已婚 @Html.RadioButtonFor(m => m.RegistrationBasicInfos.FirstOrDefault().IsMarried, true, new { name = "IsMarried" })
                    </td>
                    <td class="auto-style8 col_name">性别</td>
                    <td class="auto-style9">男 @Html.RadioButtonFor(m => m.RegistrationBasicInfos.FirstOrDefault().SexEnum, "男", new { name = "IsMarried" })
                        女 @Html.RadioButtonFor(m => m.RegistrationBasicInfos.FirstOrDefault().SexEnum, "女", new { name = "IsMarried" })
                    </td>
                </tr>
                <tr>
                    <td class="auto-style2 col_name" colspan="2">身高</td>
                    <td class="auto-style16">@Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Height, new { @class = "longTxt" })</td>
                    <td class="auto-style15 col_name">视力</td>
                    <td class="auto-style14">左 @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().EyeLeft, new { @class = "miniTxt" })
                        右 @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().EyeRight, new { @class = "miniTxt" })
                    </td>
                    <td class="auto-style8 col_name">眼镜</td>
                    <td class="auto-style9">@Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().EyeGlass, new { @class = "longTxt" })</td>
                </tr>
                <tr>
                    <td class="auto-style2 col_name" colspan="2">体重</td>
                    <td class="auto-style16">
                        @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Weight, new { @class = "longTxt" })
                    </td>
                    <td class="auto-style15 col_name">最高学历</td>
                    <td class="auto-style14">
                        @Html.DropDownList("EducationLevelEnum")
                    </td>
                    <td class="auto-style8 col_name">血型</td>
                    <td class="auto-style9">
                        @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Blood, new { @class = "longTxt" })
                    </td>
                </tr>
                <tr>
                    <td class="auto-style2 col_name" colspan="2">身份证号</td>
                    <td class="auto-style16" colspan="2">
                        @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().IDCard, new { @class = "longTxt" })
                    </td>
                    <td class="auto-style14 col_name">出生地</td>
                    <td class="auto-style8" colspan="2">
                        @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().BirthPlace, new { @class = "longTxt" })
                    </td>
                </tr>
                <tr>
                    <td class="auto-style2 col_name" colspan="2">家庭地址</td>
                    <td class="auto-style16" colspan="5">
                        @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().HomeAddress, new { @class = "longTxt" })
                    </td>
                </tr>
                <tr>
                    <td class="auto-style2 col_name" colspan="2">持有何种资格证</td>
                    <td class="auto-style16" colspan="5">
                        @Html.TextAreaFor(m => m.RegistrationBasicInfos.FirstOrDefault().Certificate, new { @class = "textArea" })
                    </td>
                </tr>
                <tr>
                    <td class="auto-style2 col_name" colspan="2">联系方式</td>
                    <td class="auto-style16 col_name">座机</td>
                    <td class="auto-style15">
                        @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().PhoneNum, new { @class = "longTxt" })
                    </td>
                    <td class="auto-style14 col_name">手机号码</td>
                    <td class="auto-style8" colspan="3">
                        @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Mobile, new { @class = "longTxt" })
                    </td>
                </tr>
                <tr>
                    <td class="auto-style2 col_name" colspan="2">是否持有护照</td>
                    <td class="auto-style4" colspan="2">否 @Html.RadioButtonFor(m => m.RegistrationBasicInfos.FirstOrDefault().IsGotpassport, false, new { name = "IsGotpassport" })
                        是 @Html.RadioButtonFor(m => m.RegistrationBasicInfos.FirstOrDefault().IsGotpassport, true, new { name = "IsGotpassport" })
                    </td>
                    <td class="auto-style14 col_name">有无出国经历</td>
                    <td class="auto-style8" colspan="3">否 @Html.RadioButtonFor(m => m.RegistrationBasicInfos.FirstOrDefault().HasAbroadExperience, false, new { name = "HasAbroadExperience" })
                        有 @Html.RadioButtonFor(m => m.RegistrationBasicInfos.FirstOrDefault().HasAbroadExperience, true, new { name = "HasAbroadExperience" })
                    </td>
                </tr>
            </table>
        }

        <p class="pItem">
            学历
            <button type="button" class="btn btn-link btn-xs pull-right" id="btnAddEducations"><span class="glyphicon glyphicon-plus"></span>&nbsp;新增</button>
        </p>
        <table class="auto-style18" id="tbEduncation">
            <thead>
                <tr>
                    <td class="col_name">起止年月</td>
                    <td class="col_name">学校名称</td>
                    <td class="col_name">学历/专业</td>
                    <td class="col_name">操作</td>
                </tr>
            </thead>
            <tbody>
                @if (registrationEducations != null)
                {
                    foreach (var e in registrationEducations)
                    { 
                    <tr>
                        <td>
                            <input type='text' name='StartDate' id="sdateEducation" data-nextId="edateEducation" style="width:100px" value='@e.StartDate.Value.ToString("yyyy-MM-dd")'  class="date_txt input_font"/>
                            ~<input type='text' name='EndDate' id="edateEducation" data-preId="sdateEducation" style="width:100px" value='@e.EndDate.Value.ToString("yyyy-MM-dd")' class="date_txt input_font"/>
                        </td>
                        <td>
                            <input type='text' name='School' style="width:100%"  value='@e.School' />
                        </td>
                        <td>
                            <input type='text' name='Major' style="width:100%"  value='@e.Major' />
                        </td>
                        <td>
                            <button type="button" class="btn btn-link btn-xs btnEditEducations" data-id="@e.RegistrationEducationId" >编辑</button>
                        </td>
                    </tr>
                    }
                }
            </tbody>
        </table>

        <p class="pItem">
            工作经历
                        <button type="button" class="btn btn-link btn-xs pull-right" id="btnAddJobs"><span class="glyphicon glyphicon-plus"></span>&nbsp;新增</button>
        </p>
        <table class="auto-style19" id="tbJob">
            <thead>
                <tr>
                    <td class="col_name" style="width: 200px">起止年月</td>
                    <td class="col_name">单位名称</td>
                    <td class="col_name">岗位</td>
                    <td class="col_name">具体内容、使用机械</td>
                    <td class="col_name" style="width: 50px">月收入<br />
                        （元）</td>
                    <td class="col_name">操作</td>
                </tr>
            </thead>
            <tbody>
                @if (registrationJobs != null)
                {
                    foreach (var e in registrationJobs)
                    { 
                    <tr>
                        <td>
                            <input type='text'  style="width:88px" name='StartDate' id="sdateJob" data-nextId="edateJob" value='@e.StartDate.Value.ToString("yyyy-MM-dd")' class="date_txt input_font" />
                            <input type='text' style="width:88px"  name='EndDate' id="edateJob" data-preId="sdateJob"  value='@e.EndDate.Value.ToString("yyyy-MM-dd")' class="date_txt input_font"/>
                        </td>
                        <td>
                            <input type='text' name='Company'  style="width:100%" value='@e.Company' />
                        </td>
                        <td>
                            <input type='text' name='WorkRoler'  style="width:100%" value='@e.WorkRoler' />
                        </td>
                        <td>
                            <input type='text' name='WordDes'  style="width:100%" value='@e.WordDes' />
                        </td>
                        <td>
                            <input type='text' name='Salary' style="width:100%" value='@Math.Round(e.Salary.Value, 1)' />
                        </td>
                        <td>
                            <button type="button"  style="width:100%" class="btn btn-link btn-xs btnEditJobs" data-id="@e.RegistrationJobId" >编辑</button>
                        </td>
                    </tr>
                    }
                }
            </tbody>
        </table>

        <p class="pItem">
            家庭主要成员
             <button type="button" class="btn btn-link btn-xs pull-right" id="btnAddFamilays"><span class="glyphicon glyphicon-plus"></span>&nbsp;新增</button>
        </p>

        <table class="auto-style18" id="tbFamilay">
            <thead>
                <tr>
                    <td class="col_name">姓名</td>
                    <td class="auto-style25 col_name">年龄</td>
                    <td class="auto-style26 col_name">关系</td>
                    <td class="auto-style27 col_name">工作单位</td>
                    <td class="col_name">职务</td>
                    <td class="col_name">操作</td>
                </tr>
            </thead>
            <tbody>
                @if (registrationFamilays != null)
                {
                    foreach (var e in registrationFamilays)
                    { 
                    <tr>
                        <td>
                            <input type='text' name='Name'  value='@e.Name' />
                        </td>
                        <td>
                            <input type='text' name='Age' value='@e.Age' />
                        </td>
                        <td>
                            <input type='text' name='Relationship' value='@e.Relationship' />
                        </td>
                        <td>
                            <input type='text' name='Compay' value='@e.Compay' />
                        </td>
                        <td>
                            <input type='text' name='JobRoler'  value='@e.JobRoler' />
                        </td>
                        <td>
                            <button type="button" class="btn btn-link btn-xs btnEditFamilays" data-id="@e.RegistrationFamilayId" >编辑</button>
                        </td>
                    </tr>
                    }
                }
            </tbody>
        </table>
        <p class="pItem">
            自我评定
                        <button type="button" class="btn  btn-link btn-xs pull-right" id="btnEditSelfInfo"><span class="glyphicon glyphicon glyphicon-pencil"></span>&nbsp;编辑</button>

        </p>

        <table class="auto-style18" id="tbSelfInfo">
            @using (Html.BeginForm("FillRegistrationForm", "Trainee", FormMethod.Post, new { name = "selfInfoForm", id = "selfInfoForm" }))
            {
                <tr>
                    <td class="auto-style23 col_name">性格特点</td>
                    <td class="auto-style21">@Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Character, new { width = "100%" })</td>
                    <td class="auto-style23 col_name">兴趣爱好</td>
                    <td>@Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Interest, new { width = "100%" })</td>
                </tr>
                <tr>
                    <td class="auto-style23 col_name">主要优点</td>
                    <td class="auto-style21">
                        @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().Advantage, new { width = "100%" })
                    </td>
                    <td class="auto-style23 col_name">主要缺点</td>
                    <td>
                        @Html.TextBoxFor(m => m.RegistrationBasicInfos.FirstOrDefault().DisAdvantage, new { width = "100%" })
                    </td>
                </tr>
            }
        </table>
        <div class="btnDive">
            @*  <button type="button" class="btn btn-primary btn-lg" id="btnReset">重置</button>*@
            @*<button type="button" class="btn btn-primary btn-lg" id="btnTempSave">暂存</button>*@
            <button type="button" class="btn btn-primary btn-lg" id="btnSubmit">提交</button>
        </div>
    </div>
</div>
@section scripts
{
    @Scripts.Render("~/Bundles/SiteUpload")
    @Scripts.Render("~/bundles/WdatePicker")
    @Scripts.Render("~/bundles/FillRegistrationForm")
}
